package com.binhthuan.catechist.client.data;

import com.binhthuan.catechist.client.ECApplication;
import com.binhthuan.catechist.shared.constant.Parameter;
import com.binhthuan.catechist.shared.constant.Service;
import com.smartgwt.client.data.fields.DataSourceIntegerField;
import com.smartgwt.client.data.fields.DataSourceTextField;

public class AreaDS extends AbstractDS {

    public static AreaDS instance;

    private AreaDS() {
        super(Service.AREA);

        DataSourceIntegerField idField = new DataSourceIntegerField(Parameter.ID);
        idField.setHidden(true);
        idField.setPrimaryKey(true);

        DataSourceTextField nameField = new DataSourceTextField(Parameter.NAME);
        nameField.setTitle(ECApplication.getConstants().status());

        setFields(idField, nameField);
    }

    public static AreaDS getInstance() {
        if (instance == null) {
            instance = new AreaDS();
        }

        return instance;
    }
}
